﻿using Mono.Cecil;
using Mono.Cecil.Cil;

public class LuaVariableDefinition : LuaVariableReference
{
    private readonly VariableDefinition _self;
    private readonly LuaMethodDefinition _owned;
    public LuaVariableDefinition(LuaModuleDefinition module, LuaMethodDefinition owned, VariableDefinition self) : base(module, self)
    {
        _owned = owned;
        _self = self;
        StackType = self.VariableType.ToStackType();
        Name = Util.ToName(Module.TryVariableName(owned.Self as MethodDefinition, self));
    }
    public bool IsPinned
        => _self.IsPinned;

    public override ObjectKind StackType { get; }

    public override LuaVariableDefinition Resolve()
    {
        return this;
    }

    internal void Init()
    {

    }
}

